# 1 "shm.c"
# 1 "/home/diego/sodium/kernel//"
# 1 "<built-in>"
# 1 "<command-line>"
# 1 "shm.c"
# 1 "../include/kernel/semaforo.h" 1
# 20 "../include/kernel/semaforo.h"
typedef struct
{
 int inicializado;
 int valor;
 unsigned long int head;
 unsigned long int tail;

 unsigned long int procesosEnCola;

 unsigned long int cola[5];
 unsigned long int pshared;
}semaforo;





typedef struct
{
 int sem_id;
}sem_t;





typedef struct{
 int pshared;
 unsigned int value;
} sem_init_params;


void vFnEncolarProceso(semaforo *sem, unsigned long int uliId);


void vFnInicializaCola(unsigned long int *cola);


int iFnHayProcesoEnEspera(semaforo *sem);


unsigned long int uliFnDesencolarProceso(semaforo *sem);


void vFnInicializarSemaforos();
# 77 "../include/kernel/semaforo.h"
int iFnSemInit(sem_t *sem, int pshared, unsigned int value);
# 86 "../include/kernel/semaforo.h"
int iFnSemClose(sem_t *sem);
# 106 "../include/kernel/semaforo.h"
int iFnSemWait(sem_t *sem);
# 116 "../include/kernel/semaforo.h"
int iFnSemPost(sem_t *sem);

int validaExistenciaSemaforo(sem_t *sem);


int agregarSemaforoAlSistema(int pshared, unsigned int value);

void vFnVerSemaforos();
# 2 "shm.c" 2
# 1 "../include/kernel/shm.h" 1
# 18 "../include/kernel/shm.h"
typedef unsigned int size_t;
typedef int key_t;
typedef int bool;


typedef struct _stuMemoriasAtachadas_
{
 bool utilizada;
 int posicionEnShMem;
 int posicionEnAttach;
}stuMemoriasAtachadas;


typedef struct _attach_
{
 int pid;
 void * ptrShAddr;

}attach;


typedef struct _shMem_
{
 key_t key;
 unsigned long int tamanio;
 attach procAtt[5];
 bool declarada;
}shMem;

shMem memoriasCompartidas[5];




int iFnShmGet(key_t key, size_t size);


int iFnShmAt(int shmid, void * shmAddr);


int iFnShmDt(int shmid);

int iFnShmDtProc(int shmid, unsigned int uiPid);
int iFnShmDtAllProc(unsigned int uiPid);

unsigned long ulFnMaxDirShmProc(unsigned int uiPid);

void vFnInicializarShms();
void vFnVerShm();




void vFnCopiarVariablesCompartidas();



void vFnCopiarVariable(void * dest, void * src, size_t tamanio);
# 3 "shm.c" 2
# 1 "../include/kernel/definiciones.h" 1
# 14 "../include/kernel/definiciones.h"
# 1 "../include/usr/tipos.h" 1
# 15 "../include/usr/tipos.h"
typedef unsigned int dword;
typedef unsigned short word;
typedef unsigned char byte;

typedef unsigned char u8;
typedef signed char s8;
typedef unsigned short u16;
typedef signed short s16;
typedef unsigned int u32;
typedef signed int s32;


typedef struct _u80 { unsigned int word[20]; } u80;
# 15 "../include/kernel/definiciones.h" 2
# 62 "../include/kernel/definiciones.h"
char stArgAux[128];
# 4 "shm.c" 2
# 1 "../include/kernel/pcb.h" 1
# 9 "../include/kernel/pcb.h"
# 1 "../include/kernel/tiempo.h" 1
# 53 "../include/kernel/tiempo.h"
typedef unsigned long int time_t;
typedef unsigned long int clock_t;





typedef struct{

        clock_t tms_utime;


        clock_t tms_stime;


        clock_t tms_cutime;


        clock_t tms_cstime;
} tms;





typedef struct{

        int tz_minuteswest;


        int tz_dsttime;
} timezone;





typedef struct{

        unsigned long int tv_sec;


        unsigned long int tv_usec;
} timeval;





typedef struct{

        timeval it_interval;


        timeval it_value;
} itimerval;





typedef struct{

        int modes;


 long offset;


 long freq;


 long maxerror;


 long esterror;


 int status;


 long constant;


 long precision;


 long tolerance;


 timeval time;


 long tick;
} timex;





typedef struct{

        long int tv_sec;


        long int tv_nsec;
} timespec;
# 10 "../include/kernel/pcb.h" 2
# 27 "../include/kernel/pcb.h"
typedef struct {
 unsigned char ident[16];
 unsigned short type;
 unsigned short machine;
 unsigned int version;
 unsigned int entry;
 unsigned int phoff;
 unsigned int sphoff;
 unsigned int flags;
 unsigned short ehsize;
 unsigned short phentsize;
 unsigned short phnum;
 unsigned short shentsize;
 unsigned short shnum;
 unsigned short shstrndx;
} elfHeader;

typedef struct {
 unsigned int name;
 unsigned int type;
 unsigned int flags;
 unsigned int addr;
 unsigned int offset;
 unsigned int size;
 unsigned int link;
 unsigned int info;
 unsigned int addralign;
 unsigned int entsize;
}SHeader;

typedef struct {
        unsigned int type;
 unsigned int offset;
 unsigned int vaddr;
        unsigned int paddr;
        unsigned int filesz;
        unsigned int memsz;
        unsigned int flags;
        unsigned int align;
} PHeader;






typedef struct {
   elfHeader elfHeaderData;
   SHeader SHeaderData;
   PHeader PHeaderData;
   unsigned char ucbuffer[4];
} stuHeaderELF;





typedef struct {
   int iEstado;
   long int liTamanio;
} stuEsperarMemoria;
# 96 "../include/kernel/pcb.h"
typedef struct _stuPCB_{
  unsigned long int ulId;
  unsigned int uiIndiceGDT_CS;
  unsigned int uiIndiceGDT_DS;
  unsigned int uiIndiceGDT_TSS;
  unsigned int uiIndiceGDT_SS0;
  void (* vFnFuncion) ();

  unsigned long ulParentId;
  unsigned long ulUsuarioId;
  int iPrioridad;
  int iEstado;
  unsigned long lNHijos;
  int iExitStatus;
  unsigned long ulLugarTSS;
  char stNombre[25];
  unsigned int uiTamProc;
  struct stuTablaPagina * pstuTablaPaginacion;
  unsigned int uiDirBase,

        uiLimite;
  stuMemoriasAtachadas memoriasAtachadas[5];


  unsigned long ulTiempoEspera;
  unsigned long ulTiempoServicio;



  struct stuPCB* pstuPcbSiguiente;

  tms stuTmsTiemposProceso;

  itimerval timers[3];

  long lNanosleep;

  unsigned int *puRestoDelNanosleep;

    long lPidTracer;

    unsigned int uiTamanioTexto;
    unsigned int uiTamanioDatosInicializados;
    unsigned int uiTamanioStack;

    unsigned int uiTamanioOverhead;

    unsigned int uiEsperaTeclado;

    stuHeaderELF stuCabeceraELF;
    int iModoParticion;
    stuEsperarMemoria stuEsperaMemoria;
    unsigned int uiBaseSs0;
}stuPCB;
# 5 "shm.c" 2
# 1 "../include/kernel/gdt.h" 1
# 32 "../include/kernel/gdt.h"
stuPCB pstuPCB[50];

int iCOLA_FLOPPY_ES[50];

unsigned int uiCOLA_FLOPPY_ES_INDEX_INI;
unsigned int uiCOLA_FLOPPY_ES_INDEX_FIN;
unsigned int uiPROC_FLOPPY;
unsigned int uiFIN_FLOPPY;
unsigned int uiCiclo;

unsigned int uiTamHeap;
# 63 "../include/kernel/gdt.h"
typedef struct {
  unsigned short usLimiteBajo;
  unsigned short usBaseBajo;
  unsigned char ucBaseMedio;







 unsigned char ucAcesso;

  unsigned int bitLimiteAlto:4;
# 89 "../include/kernel/gdt.h"
 unsigned int bitGranularidad:4;

  unsigned char usBaseAlto;

} __attribute__((packed)) stuGDTDescriptor;






typedef struct {
   stuGDTDescriptor stuGdtDescriptorDescs[8192];
} stuEstructuraGdt;



stuEstructuraGdt *pstuTablaGdt;






typedef struct {
  unsigned int control;
  unsigned int status;
  unsigned int tag;
  unsigned int ip;
  unsigned int cs;
  unsigned int dp;
  unsigned int ds;
  u80 st[8];
} __attribute__((packed)) stuFpu;
# 131 "../include/kernel/gdt.h"
typedef struct {
  unsigned int uiEnlace;
  unsigned int esp0;
  unsigned int ss0;
  unsigned int esp1;
  unsigned int ss1;
  unsigned int esp2;
  unsigned int ss2;
  unsigned int cr3;
  unsigned int eip;
  unsigned int uiEBandera;
  unsigned int eax;
  unsigned int ecx;
  unsigned int edx;
  unsigned int ebx;
  unsigned int esp;
  unsigned int ebp;
  unsigned int esi;
  unsigned int edi;
  unsigned int es;
  unsigned int cs;
  unsigned int ss;
  unsigned int ds;
  unsigned int fs;
  unsigned int gs;
  unsigned int ldt;
  unsigned int trapbit;
  unsigned int uIOMapeoBase;
  char espacio0[1024];
  char espacio1[16];
  char espacio2[16];
  stuFpu fpu;
}stuTSS;


typedef struct {
    void * pvPuntoCarga;
    unsigned int uiTamanioTexto;
    unsigned int uiTamanioDatosInicializados;
    unsigned int uiTamanioStack;
    char stNombre [13];
} stuInfoEjecutable;







stuPCB pstuPCB[50];
stuTSS stuTSSTablaTareas[50];





typedef struct {
   char stBinario[30];
   long int liTamanio;
} stuListaEspera;


int iCantEnEspera;
stuListaEspera stListaEspera[100];
void vFnGdtInicializar(dword);

int iFnBuscaPosicionProc(unsigned long);
unsigned int uiFnSetearBaseLimiteDescriptor(int,unsigned int,unsigned int);

unsigned int iFnAgregarDescriptorGDT(unsigned int,unsigned int,unsigned int,int);

int iFnBuscarPCBLibre();
unsigned int uiFnBuscarEntradaGDTLibre();

void vFnRecorrerListaEspera();
int iFnCrearTSSReloj (void*,int,unsigned int,unsigned int,unsigned int);
int iFnCrearTSS (void*,void*,int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,int);

int iFnCrearPCB(int,void*,char*,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int,unsigned int, unsigned int, unsigned int,unsigned int);

int iFnInstanciarReloj(void *, char*);
int iFnInstanciarIdle();
int iFnInstanciarInit();

void vFnAgregarListaEspera(char*, long int);

int iFnLeerCabeceraEjecutable(char* stArchivo, stuInfoEjecutable* pstuInfo);

int iFnCrearProceso(char *,int,int);
int iFnCrearCallGate(int, unsigned short, unsigned short, unsigned char, unsigned int, unsigned int, unsigned short);
int iFnRedimensionarProceso(unsigned long ulPid, unsigned long ulBrk);

int iFnDuplicarProceso(unsigned int uiProcPadre);
int iFnEliminarProceso(unsigned int uiProcesp);
int iFnReemplazarProcesoFija( unsigned int uiProceso, unsigned char *__codigo, unsigned int size );
int iFnReemplazarProceso(unsigned long, char *, unsigned int);






char* pstFnObtenerEnviroment();


int iFnClonarProceso();
# 6 "shm.c" 2
# 1 "../include/kernel/system.h" 1
# 22 "../include/kernel/system.h"
unsigned long int uliClockTick;





typedef struct
{
    unsigned int :16;
    unsigned int TSSSegmentSelector :16;
    unsigned int :8 ;
    unsigned int Type :5;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int :16;
} __attribute__((packed)) t_TaskGate;





typedef struct
{
    unsigned int Offset1 :16;
    unsigned int SegmentSelector :16;
    unsigned int :5 ;
    unsigned int Type :8;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int Offset2 :16;
} __attribute__((packed)) t_InterruptGate;




typedef struct
{
    unsigned int Offset1 :16;
    unsigned int SegmentSelector :16;
    unsigned int :5 ;
    unsigned int Type :8;
    unsigned int DPL :2;
    unsigned int P :1;
    unsigned int Offset2 :16;
} __attribute__((packed)) t_TrapGate;




typedef union
{
    t_TaskGate TaskGate;
    t_InterruptGate InterruptGate;
    t_TrapGate TrapGate;
}stuIDTDescriptor;




typedef struct
{
    stuIDTDescriptor IDTDescriptor[256];
} stuIDT;


typedef struct
{
    dword dwLimite :16;
    dword dwBase :32;
} t_IDTRegister;

stuIDT *pstuIDT;
unsigned char ucFnObtenerScanCode();
void vFnIniciarTeclado();
void vFnIniciarExcepciones();
void vFnIniciarIDT();
void vFnHandlerGenerico();
void vFnHandlerTimer();
void vFnPlanificador();
void vFnHandlerTeclado();
void* pvFnKernelStackAdmin();


void vFnHandlerDisquette();

long vFnHandlerSyscall( long eax,
   long ebx,
   long ecx,
   long edx );

void vFnLTR(unsigned int uiSelector);
unsigned int uiFnSTR(void);
# 7 "shm.c" 2
# 1 "../include/video.h" 1
# 14 "../include/video.h"
# 1 "../include/kernel/libk/string.h" 1
# 9 "../include/kernel/libk/string.h"
inline unsigned char* ucpFnCopiarMemoria(unsigned char *ucpDestino,
      unsigned char *ucpOrigen,
      unsigned int uiTamanio);
inline unsigned char* ucpFnMemSetCero(unsigned char *ucpDirInicio,
                  unsigned int uiTamanio );

int iFnLongitudCadena (const char *cnstCadena);
int iFnCompararCadenas (const char *, const char *);
int iFnCompararCadenas2 (const char *, const char *);
int iFnCopiaCaracter (char *, const char *);
int iFnCopiaCadena (char *, const char *);

int iFnCopiaEntero (char *, const int);
int iFnCopiaFloat (char *, const float, const int);
int iFnCopiaWord (char *, const word);
int iFnCopiaByte (char *, const byte);
int iFnCopiaHexa (char *, const int);
int iFnCopiaWordHexa (char *, const word);
int iFnCopiaByteHexa (char *, const byte);
void vFnImprimirString (char *, const char *, ...);
int iFnLongitudCadena (const char *);

int iFnCopiaCadena2 (char *, const char *);
char * pstFnConcatenarCadena (char * , char * );
int iFnBuscarEnCadena (char * , char * ,int );
char * pstFnCadenaIzquierda (char * , int );
char * pstFnCadenaDerecha (char * , int );
int iFnEsNumero (char * stCadena);

void vFnStrLwr (char * stCadena);
void vFnStrUpr (char * stCadena);
# 15 "../include/video.h" 2
# 58 "../include/video.h"
typedef char* va_list;
# 100 "../include/video.h"
int iFnImprimirCadenas (int,const char*);




void vFnImprimirEntero (int,const int);




void vFnImprimirFloat (int,const double, const int);




void vFnImprimirHexa (int,const int);




void vFnImprimirWordHexa (int,const word);




void vFnImprimirByteHexa (int,const byte);





void vFnImprimirWin (int,const char*, ... );
void vFnImprimir (const char*, ... );
void vFnImprimirI (const char*, ... );

extern char cFnSysObtenerColor(int);
extern void vFnSysSetearColor(int,char);
extern void vFnSysSetearX(int,int);
extern void vFnSysSetearY(int,int);
extern void vFnClsWin(int);





void vFnImprimirContextSwitch(int color,int pid, char* nombre, int indiceGDT);
void vFnImprimirPrompt();
void vFnImprimirOk(int linea);
void vFnImprimirNOk(int linea);

void vFnImprimirVentana (int hVentana, const char *cnstCadena, ...);






int bTerminalActiva;

void vFnCambiarTerminal(void);
void vFnLog (const char *cnstCadena, ...);

void vFnLogScrollArriba();
void vFnLogScrollAbajo();

void vFnLogScrollMaximo();
void vFnLogScrollMinimo();
void vFnLogBorrar();
# 8 "shm.c" 2


extern stuPCB pstuPCB[50];
extern unsigned long ulProcActual;
# 27 "shm.c"
int iFnShmGet(key_t key, size_t tamanio)
{

 int i;
 int j;

 for(i=0;i<5;i++)
 {





  if(memoriasCompartidas[i].declarada == 1 && memoriasCompartidas[i].key==key)
  {
   if(memoriasCompartidas[i].tamanio!=tamanio)
   {
    return -1;
   }
   return i;
  }
 }

 for(i=0;i<5;i++)
 {
  if(memoriasCompartidas[i].declarada==0)
  {
   memoriasCompartidas[i].declarada=1;
   memoriasCompartidas[i].key=key;
   memoriasCompartidas[i].tamanio=tamanio;




   for(j=0;j<5;j++)
   {
    memoriasCompartidas[i].procAtt[j].pid=-1;
   }
   return i;
  }
 }


 return -1;
}
# 80 "shm.c"
int iFnShmAt(int shmid, void * shmAddr)
{

 int espacioLibrePCB=0;
 int espacioLibreShMem=0;
    int iPosicionPCBProcComparte;
 int i;

    if( shmid >= 5 ) {
        return -1;
    }





 if (memoriasCompartidas[shmid].declarada==0)
 {
  return -1;
 }






 while (espacioLibreShMem < 5 &&
 memoriasCompartidas[shmid].procAtt[espacioLibreShMem].pid!=-1)
 {
  espacioLibreShMem++;
 }

 if (espacioLibreShMem==5){
  return -1;
 }





 while (espacioLibrePCB < 5 && pstuPCB[ulProcActual].memoriasAtachadas[espacioLibrePCB].utilizada == 1)
 {
  espacioLibrePCB++;
 }


 if (espacioLibrePCB==5){
  return -1;
 }





    if( (char * )shmAddr + memoriasCompartidas[shmid].tamanio >=
            (char *)pstuPCB[ulProcActual].uiLimite ) {
        return -1;
    }




 pstuPCB[ulProcActual].memoriasAtachadas[espacioLibrePCB].utilizada = 1;
 pstuPCB[ulProcActual].memoriasAtachadas[espacioLibrePCB].posicionEnShMem = shmid;
 pstuPCB[ulProcActual].memoriasAtachadas[espacioLibrePCB].posicionEnAttach = espacioLibreShMem;

 memoriasCompartidas[shmid].procAtt[espacioLibreShMem].pid = pstuPCB[ulProcActual].ulId;





    memoriasCompartidas[shmid].procAtt[espacioLibreShMem].ptrShAddr = shmAddr;
# 163 "shm.c"
 for(i=0;i<5;i++)
 {
  if(memoriasCompartidas[shmid].procAtt[i].pid != pstuPCB[ulProcActual].ulId && memoriasCompartidas[shmid].procAtt[i].pid != -1){

                iPosicionPCBProcComparte = iFnBuscaPosicionProc(
                        memoriasCompartidas[shmid].procAtt[i].pid);


                ucpFnCopiarMemoria(
                   (unsigned char*)pstuPCB[ulProcActual].uiDirBase +
                        (unsigned int)shmAddr,
                   (unsigned char*)pstuPCB[iPosicionPCBProcComparte].uiDirBase +
                        (unsigned int)
                            memoriasCompartidas[shmid].procAtt[i].ptrShAddr,
                   memoriasCompartidas[shmid].tamanio);


                return 0;
        }
    }


 return 0;
}







int iFnShmDt(int shmid){
    return iFnShmDtProc(shmid, pstuPCB[ulProcActual].ulId);
}
# 205 "shm.c"
int iFnShmDtProc(int shmid, unsigned int uiPid) {
    int i, j;
    bool desocuparShm = 1;
    unsigned long ulPosProc;

    ulPosProc = iFnBuscaPosicionProc(uiPid);

    if( ulPosProc == -1 ) {
        return -1;
    }

    if( shmid >= 5 ) {
        return -1;
    }

    for(i=0;i<5;i++)
    {
        if(memoriasCompartidas[shmid].procAtt[i].pid == uiPid)
        {
            memoriasCompartidas[shmid].procAtt[i].pid = -1;


            for(j=0; j<5; j++) {
                if(pstuPCB[ulPosProc].memoriasAtachadas[j].posicionEnShMem == shmid) {
                    pstuPCB[ulPosProc].memoriasAtachadas[j].utilizada = 0;
                }
            }
        }
        else if(memoriasCompartidas[shmid].procAtt[i].pid != -1)
        {


            desocuparShm = 0;
        }
    }


    if(desocuparShm == 1)
    {
        memoriasCompartidas[shmid].declarada = 0;
        memoriasCompartidas[shmid].key = 0;
        memoriasCompartidas[shmid].tamanio = 0;
    }

    return 0;
}







int iFnShmDtAllProc(unsigned int uiPid) {
    int i;
    unsigned long ulPosProc;

    ulPosProc = iFnBuscaPosicionProc(uiPid);

    if( ulPosProc == -1 ) {
        return -1;
    }

    for(i=0; i<5; i++) {
        if( pstuPCB[ulPosProc].memoriasAtachadas[i].utilizada == 1 ) {
            iFnShmDtProc(pstuPCB[ulPosProc].memoriasAtachadas[i].posicionEnShMem, uiPid);
        }
    }

    return 0;
}







unsigned long ulFnMaxDirShmProc(unsigned int uiPid) {
    int i;
    int iPosProc;
    int shmid;
    int iPosEnAtt;
    unsigned long ulMaxDir;

    iPosProc = iFnBuscaPosicionProc(uiPid);

    if( iPosProc == -1 ) {
        return -1;
    }

    ulMaxDir = 0;
    for(i=0; i<5; i++) {
        if( pstuPCB[iPosProc].memoriasAtachadas[i].utilizada == 1 ) {
            shmid = pstuPCB[iPosProc].memoriasAtachadas[i].posicionEnShMem;
            iPosEnAtt= pstuPCB[iPosProc].memoriasAtachadas[i].posicionEnAttach;
            if(((char*)memoriasCompartidas[shmid].procAtt[iPosEnAtt].ptrShAddr +
                memoriasCompartidas[shmid].tamanio) > (char*)ulMaxDir) {
                ulMaxDir = (unsigned long)(char*)
                    memoriasCompartidas[shmid].procAtt[iPosEnAtt].ptrShAddr +
                    memoriasCompartidas[shmid].tamanio;
            }
        }
    }

    return ulMaxDir;
}





void vFnInicializarShms(){

 int i;

 shMem shm;
 shm.key = 0;
 shm.tamanio = 0;
 shm.declarada = 0;

 for (i=0;i<5;i++)
 {
  shm.procAtt[i].pid=-1;
 }

 for (i=0;i<5;i++)
 {
  memoriasCompartidas[i]=shm;
 }
}





void vFnVerShm()
{
 int i,j;

 vFnImprimir("\n\nMemorias Compartidas del Sistema:\n");
 for (i=0;i<5;i++)
 {
  vFnImprimir("Key: %d, Tamanio: %d, Declarada %d, Pids: ", memoriasCompartidas[i].key, memoriasCompartidas[i].tamanio, memoriasCompartidas[i].declarada);

  for (j=0;j<5;j++)
  {
   vFnImprimir("[%d]",memoriasCompartidas[i].procAtt[j].pid);
  }

  vFnImprimir("\n");
 }
}





void vFnCopiarVariablesCompartidas()
{
 int srcIndiceShMem;
 int srcIndiceEnAttach;

    int iPosicionPCBProcComparte;
    int i, j;
 int k;
    unsigned char *pcAuxSrc;
    unsigned char *pcAuxDest;


 for (i=0; i<5; i++)
 {

  if (pstuPCB [ulProcActual].memoriasAtachadas[i].utilizada == 1)
  {

   srcIndiceShMem = pstuPCB [ulProcActual].memoriasAtachadas[i].posicionEnShMem;
   srcIndiceEnAttach = pstuPCB [ulProcActual].memoriasAtachadas[i].posicionEnAttach;

            pcAuxSrc = (unsigned char*) pstuPCB [ulProcActual].uiDirBase +(unsigned int) (memoriasCompartidas[srcIndiceShMem].procAtt[srcIndiceEnAttach].ptrShAddr);


   for (j=0; j<5; j++)
   {

    if (memoriasCompartidas[srcIndiceShMem].procAtt[j].pid != -1)
    {


                    iPosicionPCBProcComparte = iFnBuscaPosicionProc(
                        memoriasCompartidas[srcIndiceShMem].procAtt[j].pid);
                    pcAuxDest = (unsigned char*) pstuPCB [iPosicionPCBProcComparte].uiDirBase + (unsigned int) (memoriasCompartidas[srcIndiceShMem].procAtt[j].ptrShAddr);

                    ucpFnCopiarMemoria(
                        pcAuxDest,
                        pcAuxSrc,
                        memoriasCompartidas[srcIndiceShMem].tamanio);
                }
            }
        }
    }
}
# 415 "shm.c"
void vFnCopiarVariable(void* dest, void *src, size_t tamanio)
{

 byte *auxSrc;
 byte *auxDest;
 int k;

 auxSrc = (byte *) src;
 auxDest = (byte *) dest;

 for (k=0; k<tamanio; k+=sizeof(byte))
 {
  *(auxDest+k) = *(auxSrc+k);
 }

}
